package com.anwen.mongoa.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.anwen.mongo.service.impl.ServiceImpl;
import com.anwen.mongoa.entity.dto.StudentDTO;
import com.anwen.mongoa.entity.po.Student;
import com.anwen.mongoa.service.StudentService;

import java.util.List;

/**
 * @author Jungle
 * @create 2024-05-22 16:39
 */
public class StudentServiceImpl extends ServiceImpl<Student> implements StudentService {
    /**
     * 新增学生
     */
    @Override
    public Boolean save(StudentDTO dto) {
        return save(BeanUtil.copyProperties(dto,Student.class,"id"));
    }

    /**
     * 删除学生
     */
    @Override
    public Boolean delete(List<Long> ids) {
        return removeBatchByIds(ids);
    }
    @Override
    public Boolean update(StudentDTO dto) {
        return updateById(BeanUtil.copyProperties(dto,Student.class));
    }
}
